package com.czy.owner.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.czy.owner.R;
import com.czy.owner.entity.PersonDataModel;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;

/**
 * Created by wangyang on 2017/5/8 0008.
 */

public class PersonDataAdapter extends RecyclerArrayAdapter<PersonDataModel> {
    public PersonDataAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new PersonViewHolder(parent);
    }

    class PersonViewHolder extends BaseViewHolder<PersonDataModel> {
        private ImageView imgPersonBottom;
        private TextView tvPersonBottom;

        public PersonViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_person_bottom);
            imgPersonBottom = $(R.id.img_person_bottom);
            tvPersonBottom = $(R.id.tv_person_bottom);
        }

        @Override
        public void setData(PersonDataModel data) {
            super.setData(data);
            tvPersonBottom.setText(data.getName());
            if (data.getName().equals("工单记录")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_consumption_record);
            }
            if (data.getName().equals("联系客服")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_contact_customer_service);
            }
            if (data.getName().equals("收货地址")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_goods_receiver_adress);
            }
            if (data.getName().equals("意见反馈")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_feed_back);
            }
            if (data.getName().equals("关于我们")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_about_us);
            }
            if (data.getName().equals("车检单")) {
                imgPersonBottom.setImageResource(R.mipmap.icon_car_check);
            }
        }
    }

}